package com.security.controller;

import com.security.service.AppInfoIService;
import com.security.vo.RestfulDTO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * Package: com.security.controller
 * Description：获取和验证access_token
 * Author: huangjian
 * Date:  2020/9/16 14:05
 * Modified By:
 * @author huangjian
 */
@RequestMapping("/api")
@RestController
public class TokenController {
    @Resource
    private AppInfoIService appInfoIService;
    @GetMapping("/getAccessToken")
    public RestfulDTO getAccessToken(String appId, String appSecret){
        return appInfoIService.getAccessToken(appId, appSecret);
    }

    @GetMapping("/refreshAccessToken")
    public RestfulDTO refreshAccessToken(String refresh_token){
        return appInfoIService.refreshAccessToken(refresh_token);
    }
}
